package com.chat.admin.controller;

import com.chat.admin.service.ClientBasicService;
import com.chat.common.pojo.ClientBasic;
import com.chat.common.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 管理员管理客户端基础设置
 */
@RestController
@Validated
@RequestMapping("/admin/clientBasic")
public class ClientBasicController {

    @Autowired
    ClientBasicService clientBasicService;

    /**
     * 获取客户端基础设置
     * @return
     */
    @GetMapping("/getClientBasic")
    public R<ClientBasic> getClientBasic(){
        return R.succeed(clientBasicService.getClientBasic());
    }

    /**
     * 修改客户端基础设置
     * @param clientBasic
     * @return
     */
    @PostMapping("/setClientBasic")
    public R setClientBasic(@RequestBody ClientBasic clientBasic){
        if(clientBasicService.setClientBasic(clientBasic) == 1){
            return R.succeed("修改成功");
        }
        return R.succeed("修改失败");
    }
}
